package com.example.design.factory.version6;

/**
 * 基于简单工厂的反射工厂
 */
public class Factory {
   public  static  Object getInstance(String className){

       Object obj=null;

       try {
           Class<?> c=Class.forName(className);

           obj=c.newInstance();
       } catch (ClassNotFoundException e) {
           e.printStackTrace();
       } catch (InstantiationException e) {
           e.printStackTrace();
       } catch (IllegalAccessException e) {
           e.printStackTrace();
       }

       return  obj;
   }
}
